<?php
/**
 * Created by 张彪.
 * User: 小马出行
 * Date: 2018/1/16
 * Time: 16:57
 */
namespace app\inter\model;
use \think\Model;
use think\Db;
class DriverMoneyLogModel extends InterBase
{
    public function getLog($map,$field='*',$flag=true,$page=1,$limit=10,$config='')
    {
        $config = $config?:$this->config;
        return $flag ? Db::connect($config)->name('driver_money_log a')->join(['xm_driver_base'=>'b'],'a.driver_id=b.driver_id','left')
            ->join('order_common c','c.id=a.common_id','left')
            ->where($map)->field($field)->page($page,$limit)->select():
            Db::connect($config)->name('driver_money_log a')->join(['xm_driver_base'=>'b'],'a.driver_id=b.driver_id','left')
                ->join('order_common c','c.id=a.common_id','left')
                ->where($map)->field($field)->find();
    }

    public function addLog($data)
    {
        return Db::table('inter_driver_money_log')->insertGetId($data);
    }
}